package com.fishery.processing.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.util.Date;
import java.io.Serializable;

import com.fishery.entity.GlobalException;
import com.fishery.entity.StatusCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jdk.nashorn.internal.runtime.logging.Logger;

/**
 * <p>
 * 
 * </p>
 *
 * @author run
 * @since 2021-03-12
 */
@TableName("t_processing_material_inventory")
@ApiModel(value="TProcessingMaterialInventory对象", description="原料库存表")
public class MaterialInventory implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "库存信息id", hidden = true)
    @TableId(value = "id", type = IdType.ID_WORKER_STR)
    private String id;

    @ApiModelProperty(value = "原料id")
    private String materialId;

    @ApiModelProperty(value = "原料名称")
    private String materialName;

    @ApiModelProperty(value = "原料质量 /kg")
    private Double materialWeight;

    @ApiModelProperty(value = "所属基地id")
    private String baseId;

    @ApiModelProperty(value = "原料供应商所属基地名称")
    private String supplierBase;

    @ApiModelProperty(value = "原料供应商名称")
    private String supplierName;

    @ApiModelProperty(value = "原料供应商类型 1养殖基地、2加工厂、3冷库")
    private Integer supplierType;

    @ApiModelProperty(value = "创建时间", hidden = true)
    @TableField(fill = FieldFill.INSERT)
    private Date gmtCreate;

    @ApiModelProperty(value = "修改时间", hidden = true)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;

    @ApiModelProperty(value = "逻辑删除", hidden = true)
    @TableField(fill = FieldFill.INSERT)
    @TableLogic
    private Integer isDeleted;

    @ApiModelProperty(value = "乐观锁", hidden = true)
    @TableField(fill = FieldFill.INSERT)
    @Version
    private Integer version;

    public Double getMaterialWeight() {
        return materialWeight;
    }

    public void setMaterialWeight(Double materialWeight) {
        this.materialWeight = materialWeight;
    }

    public String getBaseId() {
        return baseId;
    }

    public void setBaseId(String baseId) {
        this.baseId = baseId;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getMaterialId() {
        return materialId;
    }

    public void setMaterialId(String materialId) {
        this.materialId = materialId;
    }

    public String getMaterialName() {
        return materialName;
    }

    public void setMaterialName(String materialName) {
        this.materialName = materialName;
    }

    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public Date getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Date gmtModified) {
        this.gmtModified = gmtModified;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }

    public Integer getSupplierType() {
        return supplierType;
    }

    public void setSupplierType(Integer supplierType) {
        if (supplierType == null || supplierType > 3 || supplierType < 1){
            throw new GlobalException(StatusCode.ERROR,"原料供应商类型不合法");
        }
        this.supplierType = supplierType;
    }

    public String getSupplierBase() {
        return supplierBase;
    }

    public void setSupplierBase(String supplierBase) {
        this.supplierBase = supplierBase;
    }

    @Override
    public String toString() {
        return "MaterialInventory{" +
        "id=" + id +
        ", materialId=" + materialId +
        ", materialName=" + materialName +
        ", materialWeight=" + materialWeight +
        ", gmtCreate=" + gmtCreate +
        ", gmtModified=" + gmtModified +
        ", isDeleted=" + isDeleted +
        ", version=" + version +
        "}";
    }
}
